package com.sanniu;

import com.jfinal.kit.PathKit;
import io.jboot.codegen.model.JbootBaseModelGenerator;
import io.jboot.codegen.model.JbootModelGenerator;
import io.jboot.codegen.service.JbootServiceImplGenerator;
import io.jboot.codegen.service.JbootServiceInterfaceGenerator;

public class CodeGenerator {
    public static void main(String args[]) {
        //依赖model的包名
        String modelPackage = "com.sanniu.model";



        String baseModelPackage = modelPackage + ".base";
        String modelDir = PathKit.getWebRootPath() + "/src/main/java/" + modelPackage.replace(".", "/");
        String baseModelDir = PathKit.getWebRootPath() + "/src/main/java/" + baseModelPackage.replace(".", "/");
        System.out.println("start generate...");

        (new JbootBaseModelGenerator(baseModelPackage, baseModelDir)).generate();
        (new JbootModelGenerator(modelPackage, baseModelPackage, modelDir)).generate();
        //生成service 的包名
        String servicePackage = "com.sanniu.service";
        (new JbootServiceInterfaceGenerator(servicePackage, modelPackage)).generate();
        (new JbootServiceImplGenerator(servicePackage, modelPackage)).setImplName("provider").generate();


    }
}
